@extends('admin/layout')
@section('title','商品管理')
@section('introduce')
<script src="{{asset('admin/local/imageselect/imageselect.js')}}"></script>
<link rel="stylesheet" href="{{asset('admin/local/imageselect/imageselect.css')}}"/>
@stop
@section('content')
<!-- Content Header (Page header) -->
<section class="content-header">
  <h1>
    商品列表
    <small>添加商品</small>
  </h1>
  <ol class="breadcrumb">
  	<li><a href="{{asset('admin/index')}}"><i class="fa fa-th"></i> 管理首页</a></li>
    <li><i class="fa fa-shopping-cart"></i> 商品管理</li>
    <li><a href="{{asset('admin/product')}}"><i class="fa fa-list-ul"></i> 商品列表</a></li>
    <li class="active">添加商品</li>
  </ol>
</section>

<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-md-12">
	  	  <!-- box start -->
          <div class="box box-info">
	        <div class="box-header with-border">
	          <h3 class="box-title"><i class="fa fa-cart-plus"> 添加商品</i></h3>
	        </div>
          @if(session('error'))
            {{session('error')}}
          @endif
          @if(count($errors)>0)
          <div class="alert alert-danger">
            <ul>
              @foreach($errors->all() as $error)
                <li>{{$error}}</li>
              @endforeach
            </ul>
          </div>
          @endif
          
            <!-- form start -->
            <form class="form-horizontal" action="{{asset('admin/product')}}" method="post" enctype="multipart/form-data">
              {{csrf_field()}}
              <div class="box-body">
                <div class="form-group">
                  <label for="selectcrowd" class="col-sm-1 col-md-2 control-label">人群：</label>
                  <div class="col-sm-3 col-md-2">
                    <select id="selectcrowd" class="form-control" name="cro_id">
                      @foreach($crowds as $v)
                        <option value="{{$v->crowd_id}}">{{$v->crowd_type}}</option>
                      @endforeach
                    </select>
                  </div>
                  <label for="selectsport" class="col-sm-1 col-md-1 control-label">运动：</label>
                  <div class="col-sm-3 col-md-2">
                    <select id="selectsport" class="form-control" name="spo_id">
                     {!!$msports_str!!} 
                    </select>
                  </div>
                  <script>
                      $('#selectcrowd').on('change',function(){
                        if($(this).val()==1){
                          $('#selectsport').html('{!!$msports_str!!}');
                        }else if($(this).val()==2){
                          $('#selectsport').html('{!!$wsports_str!!}');
                        }else if($(this).val()==3){
                          $('#selectsport').html('{!!$csports_str!!}');
                        }
                      });
                  </script>               
                  <label for="selectbrand" class="col-sm-1 col-md-1 control-label">品牌：</label>
                  <div class="col-sm-3 col-md-3">
                    <select id="selectbrand" name="brand_logo" class="form-control">
                      @foreach($brands as $brand)
                      <option value="{{$brand->brand_id}}">/uploads/product/brand/{{$brand->brand_logo}}</option>
                      @endforeach
                    </select>
                  </div>
                  <script>
                    $(function(){
                      $('select[name=brand_logo]').ImageSelect({dropdownWidth:80});
                      $('.jqis_header').css({'width':'80px','height':'62px'});
                    });
                  </script>
                </div>
                <div class="form-group {{--has-error--}}">
                  <label for="inputtitle" class="col-sm-2 col-md-2 control-label">商品标题：</label>
                  <div class="col-sm-6 col-md-5">
                    <input type="text" class="form-control" id="inputtitle" placeholder="请输入商品标题" name="title" value="{{old('title')}}">
                  </div>
                  <span class="help-block col-sm-4 col-md-5">
                  <!--
                  <i class="fa fa-times text-red"> </i>
                  -->
                  </span>
                </div>
                <div class="form-group {{--has-error--}}">
                  <label for="inputdes" class="col-sm-2 col-md-2 control-label">商品描述：</label>
                  <div class="col-sm-6 col-md-5">
                    <textarea class="col-sm-6 col-md-5 form-control" style="resize:none;height:100px;" name="description"></textarea>
                  </div>
                  <span class="help-block col-sm-4 col-md-5">
                  <!--<i class="fa fa-times text-red"> </i>-->
                  </span>
                </div>
                <div class="form-group">
                  <label for="inputmprice" class="col-sm-1 col-md-2 control-label" style="font-size:12px;">市场价：</label>
                  <div class="col-sm-3 col-md-2">
                    <input type="text" class="form-control" id="inputmprice" placeholder="请输入市场价" name="mprice" value="{{old('mprice')}}">
                  </div>
                  <label for="inputsprice" class="col-sm-1 col-md-1 control-label" style="font-size:12px;">商城价：</label>
                  <div class="col-sm-3 col-md-2">
                    <input type="text" class="form-control" id="inputsprice" placeholder="请输入商城价" name="sprice" value="{{old('sprice')}}">
                  </div>
                  <label for="inputlprice" class="col-sm-1 col-md-1 control-label" style="font-size:12px;">物流价：</label>
                  <div class="col-sm-3 col-md-2">
                    <input type="text" class="form-control" id="inputlprice" placeholder="请输入物流价" value="0" name="lprice">
                  </div>
                </div>  
                <div class="form-group">
                  <label for="inputlogo" class="col-sm-2 col-md-2 control-label" name="logo_pic">LOGO图片：</label>
                  <div class="col-sm-10 col-md-10">
                    <input type="file" class="" id="inputlogo" name="logo_pic">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputad" class="col-sm-2 col-md-2 control-label">广告图片：</label>
                  <div class="col-sm-10 col-md-10">
                    <input type="file" class="" id="inputad" name="ad_pic">
                  </div>
                </div>
                <div class="form-group">
                  <label for="selectnew" class="col-sm-2 col-md-2 control-label">是否新品推荐：</label>
                  <div class="col-sm-4 col-md-3">
                    <select id="selectnew" class="form-control" name="new_recommended">
                      <option value="1">否</option>
                      <option value="2">是</option>
                    </select>
                  </div>
                </div>				  
              </div>
              <div class="box-footer">
                <input type="reset" class="btn btn-default col-sm-2 col-sm-offset-2 col-md-2 col-md-offset-2" value="清空"/>
                <button class="btn btn-info col-xs-offset-1 col-sm-2 col-sm-offset-1 col-md-2 col-md-offset-1">提交</button>
              </div>
            </form>
            <!-- /.form -->
          </div>
          <!-- /.box -->
	    </div>
    </div>
</section>
<!-- /.content -->
@stop